Assembly: C1.LiveLinq (in C1.LiveLinq.dll)
Syntax
C# |
---|
public static IIndexedSource<T> AsIndexed<T>( this IIndexedSource<T> source ) |
Visual Basic |
---|
<ExtensionAttribute> _ Public Shared Function AsIndexed(Of T) ( _ source As IIndexedSource(Of T) _ ) As IIndexedSource(Of T) |
Parameters
- source
- Type: C1.LiveLinq.Indexing..::..IIndexedSource<(Of <(<'T>)>)>
The collection to type as IIndexedSource<(Of <(<'T>)>)>.
Type Parameters
- T
- The type of the elements of source.
Return Value
The input collection typed as IIndexedSource<(Of <(<'T>)>)>.Remarks
This method has no effect other than to change the compile-time type of source from a type that implements IIndexedSource<(Of <(<'T>)>)> to IIndexedSource<(Of <(<'T>)>)> itself. It is used to choose between query implementations when a collection implements IIndexedSource<(Of <(<'T>)>)> but also has a different set of public query methods available.
The main scenario is when you want to perform queries on live views without creating new live views.
Live views have their own implementations of query operators defined in the View<(Of <(<'T>)>)> class. Live view implementations are heavier, require more resources, so it is not recommended to use live view implementations in cases where you don't need live view functionality (for example, for querying read-only collections), see Live View Performance. If you have a live view, but want to query it using operators from IndexedQueryExtensions instead of View<(Of <(<'T>)>)>, use this method to "downgrade" the live view to an IIndexedSource<(Of <(<'T>)>)>. This method does not cause the live view to lose its "live" functionality, it simply returns the live view's implementation of the IIndexedSource<(Of <(<'T>)>)> interface.